<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Cancellation slot requirements</title>
<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../../boost_asio.html" title="Boost.Asio">
<link rel="up" href="../reference.html" title="Reference">
<link rel="prev" href="CancellationHandler.html" title="Cancellation handler requirements">
<link rel="next" href="CompletionCondition.html" title="Completion condition requirements">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td>
<td align="center"><a href="../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="CancellationHandler.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../boost_asio.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="CompletionCondition.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="boost_asio.reference.CancellationSlot"></a><a class="link" href="CancellationSlot.html" title="Cancellation slot requirements">Cancellation slot
      requirements</a>
</h3></div></div></div>
<p>
        A type <code class="computeroutput"><span class="identifier">X</span></code> meets the <code class="computeroutput"><span class="identifier">CancellationSlot</span></code> requirements if it satisfies
        the requirements of <code class="computeroutput"><span class="identifier">CopyConstructible</span></code>
        (C++Std [copyconstructible]) and <code class="computeroutput"><span class="identifier">Destructible</span></code>
        (C++Std [destructible]), as well as the additional requirements listed below.
      </p>
<p>
        In the table below, <code class="computeroutput"><span class="identifier">x1</span></code> and
        <code class="computeroutput"><span class="identifier">x2</span></code> denote (possibly const)
        values of type <code class="computeroutput"><span class="identifier">X</span></code>, <code class="computeroutput"><span class="identifier">mx1</span></code> denotes an xvalue of type <code class="computeroutput"><span class="identifier">X</span></code>, <code class="computeroutput"><span class="identifier">H</span></code>
        denotes a type that satisfies <code class="computeroutput"><span class="identifier">CancellationHandler</span></code>,
        <code class="computeroutput"><span class="identifier">h</span></code> denotes an xvalue of type
        <code class="computeroutput"><span class="identifier">H</span></code>, and <code class="computeroutput"><span class="identifier">u0</span></code>
        to <code class="computeroutput"><span class="identifier">uN</span></code> denote identifiers.
      </p>
<div class="table">
<a name="boost_asio.reference.CancellationSlot.t0"></a><p class="title"><b>Table 8. CancellationSlot requirements</b></p>
<div class="table-contents"><table class="table" summary="CancellationSlot requirements">
<colgroup>
<col>
<col>
<col>
</colgroup>
<thead><tr>
<th>
                <p>
                  expression
                </p>
              </th>
<th>
                <p>
                  type
                </p>
              </th>
<th>
                <p>
                  assertion/note<br> pre/post-conditions
                </p>
              </th>
</tr></thead>
<tbody>
<tr>
<td>
                <p>
                  <code class="computeroutput"><span class="identifier">X</span> <span class="identifier">u</span><span class="special">(</span><span class="identifier">x1</span><span class="special">);</span></code>
                </p>
              </td>
<td>
              </td>
<td>
                <p>
                  Shall not exit via an exception.<br> <br> post: <code class="computeroutput"><span class="identifier">u</span> <span class="special">==</span>
                  <span class="identifier">x1</span></code>.
                </p>
              </td>
</tr>
<tr>
<td>
                <p>
                  <code class="computeroutput"><span class="identifier">X</span> <span class="identifier">u</span><span class="special">(</span><span class="identifier">mx1</span><span class="special">);</span></code>
                </p>
              </td>
<td>
              </td>
<td>
                <p>
                  Shall not exit via an exception.<br> <br> post: <code class="computeroutput"><span class="identifier">u</span></code> equals the prior value of
                  <code class="computeroutput"><span class="identifier">mx1</span></code>.
                </p>
              </td>
</tr>
<tr>
<td>
                <p>
                  <code class="computeroutput"><span class="identifier">x1</span> <span class="special">==</span>
                  <span class="identifier">x2</span></code>
                </p>
              </td>
<td>
                <p>
                  <code class="computeroutput"><span class="keyword">bool</span></code>
                </p>
              </td>
<td>
                <p>
                  Returns <code class="computeroutput"><span class="keyword">true</span></code> only
                  if <code class="computeroutput"><span class="identifier">x1</span></code> and <code class="computeroutput"><span class="identifier">x2</span></code> can be interchanged with identical
                  effects. <br> <code class="computeroutput"><span class="keyword">operator</span><span class="special">==</span></code> shall be reflexive, symmetric,
                  and transitive, and shall not exit via an exception.
                </p>
              </td>
</tr>
<tr>
<td>
                <p>
                  <code class="computeroutput"><span class="identifier">x1</span> <span class="special">!=</span>
                  <span class="identifier">x2</span></code>
                </p>
              </td>
<td>
                <p>
                  <code class="computeroutput"><span class="keyword">bool</span></code>
                </p>
              </td>
<td>
                <p>
                  Same as <code class="computeroutput"><span class="special">!(</span><span class="identifier">x1</span>
                  <span class="special">==</span> <span class="identifier">x2</span><span class="special">)</span></code>.
                </p>
              </td>
</tr>
<tr>
<td>
                <p>
                  <code class="computeroutput"><span class="identifier">x1</span><span class="special">.</span><span class="identifier">is_connected</span><span class="special">()</span></code>
                </p>
              </td>
<td>
                <p>
                  <code class="computeroutput"><span class="keyword">bool</span></code>
                </p>
              </td>
<td>
                <p>
                  Returns <code class="computeroutput"><span class="keyword">false</span></code> only
                  if the slot can never cause the invocation of a handler attached
                  to the slot using <code class="computeroutput"><span class="identifier">assign</span></code>
                  or <code class="computeroutput"><span class="identifier">emplace</span></code>.
                </p>
              </td>
</tr>
<tr>
<td>
                <p>
                  <code class="computeroutput"><span class="identifier">x1</span><span class="special">.</span><span class="identifier">has_handler</span><span class="special">()</span></code>
                </p>
              </td>
<td>
                <p>
                  <code class="computeroutput"><span class="keyword">bool</span></code>
                </p>
              </td>
<td>
                <p>
                  Returns <code class="computeroutput"><span class="keyword">true</span></code> if a
                  handler has been attached to the slot.
                </p>
              </td>
</tr>
<tr>
<td>
                <p>
                  <code class="computeroutput"><span class="identifier">x1</span><span class="special">.</span><span class="identifier">assign</span><span class="special">(</span><span class="identifier">h</span><span class="special">)</span></code>
                </p>
              </td>
<td>
                <p>
                  <code class="computeroutput"><span class="identifier">H</span><span class="special">&amp;</span></code>
                </p>
              </td>
<td>
                <p>
                  Destroys the existing handler that is attached to the slot, if
                  any, and attaches a move-constructed decay-copy of the handler
                  <code class="computeroutput"><span class="identifier">h</span></code>.<br> <br>
                  Returns a reference to the newly attached handler.<br> <br>
                  post: <code class="computeroutput"><span class="identifier">x1</span><span class="special">.</span><span class="identifier">has_handler</span><span class="special">()</span>
                  <span class="special">==</span> <span class="keyword">true</span></code>.
                </p>
              </td>
</tr>
<tr>
<td>
                <p>
                  <code class="computeroutput"><span class="identifier">x1</span><span class="special">.</span><span class="identifier">emplace</span><span class="special">&lt;</span><span class="identifier">H</span><span class="special">&gt;(</span><span class="identifier">u0</span><span class="special">,</span>
                  <span class="special">...,</span> <span class="identifier">uN</span><span class="special">)</span></code>
                </p>
              </td>
<td>
                <p>
                  <code class="computeroutput"><span class="identifier">H</span><span class="special">&amp;</span></code>
                </p>
              </td>
<td>
                <p>
                  Requires that <code class="computeroutput"><span class="identifier">is_constructible</span><span class="special">&lt;</span><span class="identifier">H</span><span class="special">,</span> <span class="keyword">decltype</span><span class="special">(</span><span class="identifier">u0</span><span class="special">),</span> <span class="special">...,</span>
                  <span class="keyword">decltype</span><span class="special">(</span><span class="identifier">u0</span><span class="special">)&gt;::</span><span class="identifier">value</span></code> be true.<br> <br> Destroys
                  the existing handler that is attached to the slot, if any, and
                  attaches a handler of type <code class="computeroutput"><span class="identifier">H</span></code>
                  constructed with the specified arguments <code class="computeroutput"><span class="identifier">u0</span><span class="special">,</span> <span class="special">...,</span>
                  <span class="identifier">uN</span></code>.<br> <br> Returns
                  a reference to the newly attached handler.<br> <br> post:
                  <code class="computeroutput"><span class="identifier">x1</span><span class="special">.</span><span class="identifier">has_handler</span><span class="special">()</span>
                  <span class="special">==</span> <span class="keyword">true</span></code>.
                </p>
              </td>
</tr>
<tr>
<td>
                <p>
                  <code class="computeroutput"><span class="identifier">x1</span><span class="special">.</span><span class="identifier">clear</span><span class="special">()</span></code>
                </p>
              </td>
<td>
              </td>
<td>
                <p>
                  Post: <code class="computeroutput"><span class="identifier">x1</span><span class="special">.</span><span class="identifier">has_handler</span><span class="special">()</span>
                  <span class="special">==</span> <span class="keyword">false</span></code>.
                </p>
              </td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break">
</div>
<div class="copyright-footer">Copyright © 2003-2025 Christopher M.
      Kohlhoff<p>
        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
      </p>
</div>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="CancellationHandler.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.html"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../boost_asio.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="CompletionCondition.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
